﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
using WMS.Seven.BaseService;
using WMS.Seven.Models;

namespace WMS.Seven.LossReportingManagements
{
    public class LossReportingManagementAppService : BaseAppService<LossReportingManagement, LossReportingManagementDto>, ILossReportingManagementAppService
    {
        private readonly IRepository<LossReportingManagement, int> _repository;
        public LossReportingManagementAppService(IRepository<LossReportingManagement, int> repository) : base(repository)
        {
            _repository = repository;
        }
        /// <summary>
        /// 查询 
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="ItemCode"></param>
        /// <param name="ItemName"></param>
        /// <returns></returns>
        public async Task<PagedResult<LossReportingManagement>> GetDataListAsync(int pageIndex, int pageSize, string? ItemCode, string? ItemName, string? ItemTypeCode)
        {
            // 定义初始的查询条件
            Expression<Func<LossReportingManagement, bool>> predicate = x => true;
            // 根据参数判断是否添加查询条件
            //if (!string.IsNullOrEmpty(ItemCode))
            //{
            //    predicate = predicate.And(x => x.ItemCode.Contains(ItemCode));
            //}


            return await base.GetListAsync<LossReportingManagement>(pageIndex, pageSize, "Id", true, predicate);

        }
    }
}
